// 1.引入fs模块
const fs = require('fs');

// 2.异步读取
fs.readFile('./3.观书有感.txt', (err, data) => {
  if (err) {
    console.log(err);
    return
  }
  console.log('success');
  console.log(data.toString());
});

// 3.同步读取
let data = fs.readFileSync('./3.观书有感.txt')
console.log(data.toString());